//引入项目的全部全局组件
import Nav from '@/layout/navigation/index.vue'
import Conversations from '@/layout/chat/conversations/index.vue'
import FriendsList from '@/layout/contacts/friendsList/index.vue'
import SvgIcon from './svgIcon/index.vue'
import EditUserInfo from './editUserInfo/index.vue'
import EditAvatar from './editAvatar/index.vue'
import Function from './function/index.vue'
import Video from './video/index.vue'
import Voice from './voice/index.vue'
import ChatPage from './chatPage/index.vue'
import ChatTime from './chatTime/index.vue'
import ChatMessageLeft from './chatMessageLeft/index.vue'
import ChatMessageRight from './chatMessageRight/index.vue'
import HangUp from './hangUp/index.vue'
import UploadFile from './uploadFile/index.vue'
import SendFile from './sendFile/index.vue'
import Tabbar from './tabbar/index.vue'
import SystemSettings from './systemSettings/index.vue'
import FriendInfo from './friendInfo/index.vue'
import ToChat from './toChat/index.vue'
import ChatMenuItem from './chatMenuItem/index.vue'
import WaterfallCard from './waterfallCard/index.vue'
//引入element-plus提供的全部图标组件
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
//全局对象
const allGlobalComponent: any = {
    Nav,
    Conversations,
    ChatMenuItem,
    FriendsList,
    SvgIcon,
    EditUserInfo,
    EditAvatar,
    Function,
    Video,
    Voice,
    ChatPage,
    ChatTime,
    ChatMessageLeft,
    ChatMessageRight,
    HangUp,
    UploadFile,
    SendFile,
    Tabbar,
    SystemSettings,
    FriendInfo,
    ToChat,
    WaterfallCard,
}

//对外暴露插件对象
export default {
    install(app: any) {
        //注册项目全部的全局组件
        Object.keys(allGlobalComponent).forEach((key) => {
            //注册为全局组件
            app.component(key, allGlobalComponent[key])
        })
        //将element-plus提供的图标注册为全局组件
        for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
            app.component(key, component)
        }
    },
}
